<template>
	<div>
        <!-- 找店铺 -->
		<div style="display: flex;justify-content: space-between;padding: 19px 20px;">
			<img :src="source.storeCoverImage?source.storeCoverImage:source.image" style="width: 31%;cursor: pointer;height: 85px;object-fit: contain;background-color: rgb(209 204 204 / 20%);" @click="shopdetails(source)" alt />
			<div style="width: 46%;display: flex;flex-direction: column;justify-content: space-between;margin-left:10px;">
				<div style="color: #333333;font-size: 18px;font-weight: 600;cursor: pointer;" @click="shopdetails(source)">{{source.storeName}}</div>
				<div style="flex-grow: 1;"></div>
				<div class="location line3">{{source.officeAddress}}</div>
			</div>
			<div class="right">
				<!-- <img src="../../assets/bbcz/weizhi01.png" alt=""> -->
				            <el-tooltip
              :content="source.contactPhoneNumber"
              placement="top"
              v-if="loginState"
            >
              <img
                style="cursor: pointer;margin-left:auto;"
                src="../../assets/bbcz/phone01.png"
                alt=""
              />
            </el-tooltip> 
			<img src="../../assets/bbcz/phone01.png"  style="cursor: pointer;margin-left:auto;" alt="" v-else>
				
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		props: {
			index: {
				type: Number,
				

			},
			source: {
				type: Object,
				default () {
					return {};
				}
			}
		},
		data() {
			return {
loginState:localStorage.getItem("userInfo")? true:false
			}
		},
		methods: {
            housedetails(item){
				if(item.transactionType == 1){
					const routeLink = this.$router.resolve({
						path: '/index/leaseDetails?id='+item.id
					})
					window.open(routeLink.href, '_blank')
				}else{
					const routeLink = this.$router.resolve({
						path: '/index/newHouseDetails?id='+item.id
					})
					window.open(routeLink.href, '_blank')
				}
			},
            toAgent(id){
				const routeLink = this.$router.resolve({
                    path: '/index/goldConsultant?id='+id
                })
            	window.open(routeLink.href, '_blank')
			},
            shopdetails(item){
				var path=''
				if(item.storeType==1||item.storeType==2){
					path = '/index/newDealerDetails?id='
				}else if(item.storeType==3||item.storeType==4){
					path = '/index/ownerServiceDetails?id='
				}
				const routeLink = this.$router.resolve({
					path: path+item.id
				})
				window.open(routeLink.href, '_blank')
				return
				// index/newDealerDetails
				if(item.hasOwnProperty('shopId') && item.shopId != ''){
					const routeLink = this.$router.resolve({
                        path: '/index/newDealerDetails?id='+item.shopId
                    })
        		    window.open(routeLink.href, '_blank')
				}else{
					this.$message({
						message: "个人车源！",
						type: "error",
						offset: 120,
						duration: 2000,
					});
				}
			},
		}
	}
</script>

<style lang="less" scoped>
.location{
	font-size: 14px;
	font-weight: 400;
	color: #666666;
}
.right{
	width: 20%;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-right: 20px;
	img{
		width: 35px;
		height: 35px;
	}
}
</style>